﻿using System;
using System.Web;
using Web.App.Infrastructure.Interface.Contracts;
using System.Web.Security;

namespace Web.App.Infrastructure.Interface.Implementation
{
    public class CookieFactory : ICookieFactory
    {
        public HttpCookie CreateAuthenticationCookie(string userName, bool isPersistantCookie, string cookiePath)
        {
            return CreateAuthenticationCookie(userName, isPersistantCookie);
        }

        public HttpCookie CreateAuthenticationCookie(string userName, bool isPersistantCookie)
        {
            return FormsAuthentication.GetAuthCookie(userName, isPersistantCookie);
        }

        public HttpCookie CreateCookie(string key, string value, string path)
        {
            return new HttpCookie(key, value) {Path = path};
            
        }

        public HttpCookie CreateCookie(string key, string value, DateTime expiresAt)
        {
            return new HttpCookie(key, value) { Expires = expiresAt};
        }
    }
}